package com.mycompany.client;

import com.google.inject.Guice;
import com.google.inject.Injector;
import java.io.IOException;

/**
 *
 * @author artyukhov
 */
public class ClientApplication {

    private Injector injector = Guice.createInjector(new ModuleConfiguration());

    private ConnectedClient initiateConnection() throws InterruptedException {
        LoginFrame loginFrame = injector.getInstance(LoginFrame.class);
        ConnectedClient loginObject = loginFrame.getLoginObject();
        loginFrame.dispose();
        return loginObject;
    }

    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        ClientApplication application = new ClientApplication();
        ConnectedClient client = application.initiateConnection();
        client.introduceToServer();
        client.listenServer();
        client.closeResources();
    }
}
